package com.alisls.demo.springcloud.service.user.service.impl.client;

import com.alisls.demo.springcloud.service.user.client.oauth.ClientDetailFeignClient;
import com.alisls.demo.springcloud.service.user.dto.client.OAuthClientDetailDTO;
import com.alisls.demo.springcloud.service.user.dto.client.OAuthClientDetailPwdDTO;
import com.alisls.demo.springcloud.service.user.service.client.ClientDetailService;
import lombok.AllArgsConstructor;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

/**
 * 描述信息
 *
 * @author Ke Wang
 * @date 2020/10/31
 */
@Service("clientDetailService")
@AllArgsConstructor
public class ClientDetailServiceImpl implements ClientDetailService {

    private final PasswordEncoder passwordEncoder;

    private final ClientDetailFeignClient clientDetailFeignClient;

    /**
     * 保存OAuth客户端
     * @param oAuthClientDetailPwdDTO 带密码的OAuth客户端
     * @return OAuthClientDetailDTO
     */
    @Override
    public OAuthClientDetailDTO save(OAuthClientDetailPwdDTO oAuthClientDetailPwdDTO) {
        return clientDetailFeignClient.save(oAuthClientDetailPwdDTO);
    }

    @Override
    public Integer remove(String clientId) {
        return clientDetailFeignClient.removeById(clientId);
    }

}
